import request from '../request'

/** 接口 */
const Api = {
  page: '/api/sys/resource/page',
  homeImg: '/api/sys/resource/homeImg',
  saveResource: '/api/sys/resource/saveResource',
  getModule: '/api/sys/resource/getModule',
  remove: '/api/sys/resource/remove',
  edit: '/api/sys/resource/edit',
  deleteResourcePermissionCheck: '/api/sys/resource/deleteResourcePermissionCheck',
  deleteFiles: '/api/sys/upload/deleteFiles',
  downloadDocument: '/api/sys/upload/downloadDocument',
}

/** 用户列表 */
export const page = data => {
  return request.request({
    url: Api.page,
    params: data,
    method: 'GET'
  })
}
/** 首页轮播图 */
export const homeImg = homeImg => {
  return request.request({
    url: Api.homeImg,
    method: 'GET'
  })
}
/**新增资源上传**/
export const saveResource = data => {
  return request.request({
    url: Api.saveResource,
    data: data,
    method: 'POST'
  })
}
/**删除资源**/
export const deleteFiles = data => {
  return request.request({
    url: Api.deleteFiles,
    data: data,
    method: 'POST'
  })
}
/**获取模块**/
export const getModule = data => {
  return request.request({
    url: Api.getModule,
    data: data,
    method: 'GET'
  })
}
/**资源删除**/
export const remove = data => {
  return request.request({
    url: Api.remove,
    params: data,
    method: 'DELETE'
  })
}

export const deleteResourcePermissionCheck = data => {
  return request.request({
    url: Api.deleteResourcePermissionCheck,
    params: data,
    method: 'POST'
  })
}

export const edit = data => {
  return request.request({
    url: Api.edit,
    data: data,
    method: 'PUT'
  })
}
export const downloadDocument = data => {
  return request.request({
    url: Api.downloadDocument,
    data: data,
    method: 'POST'
  })
}
